﻿using Caliburn.Micro;
using PublicModule;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SystemManage.UserManage.ViewModels
{
    public class UserViewModel : Screen
    {
        private List<UserEnt> _users;
        public List<UserEnt> UserList
        {
            get { return _users; }
            set
            {
                _users = value;
                NotifyOfPropertyChange(nameof(UserList));
            }
        }


        public UserViewModel()
        {

        }

        public async void Search(string name, int sex)
        {
            Dictionary<string, string> param = new Dictionary<string, string>();
            param.Add("name", name);
            param.Add("sex", sex.ToString());
            List<UserEnt> list = await HttpClientHelper.TryGetAsync<List<UserEnt>>("User/GetUserList", param);
            UserList = list;
        }
    }
}
